package com.pmenergy.util;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
 
public class DisciplineNode implements Serializable, Comparable<DisciplineNode> {
 
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String name;
     
    private String type;
    
    private int activeTab;
    
    private List<TabActivity> tabActivityList;
     
    public DisciplineNode(String name,String type) {
        this.name = name;
        this.type = type;
        this.tabActivityList = new ArrayList<TabActivity>();
        this.setActiveTab(-1);
    
    }
    
    public void ClearLista(){
    	if (this.tabActivityList != null)
    	this.tabActivityList.clear();
    	tabActivityList.add(new TabActivity("Total","contenido"));
    	    	
    }
   
    public void addTabActiviy(){
    	//this.setDisabled(false);
    	TabActivity tabActivity = new TabActivity("Actividad " + (this.getTabActivityList().size()) ,"");        
        this.tabActivityList.add(tabActivity);
        this.setActiveTab(this.getTabActivityList().size() - 1);
    	
    }
 	
    public List<TabActivity> getTabActivityList() {
        return this.tabActivityList;
    }
 
    public void setTabActivityList(List<TabActivity> tabActivityList) {
        this.tabActivityList = tabActivityList;
    }
    
    public int getActiveTab() {
        return this.activeTab;
    }
 
    public void setActiveTab(int activeTab) {
        this.activeTab = activeTab;
    }
    
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    
 
    public String getType() {
        return type;
    }
 
    public void setType(String type) {
        this.type = type;
    }
 
    //Eclipse Generated hashCode and equals
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        result = prime * result + ((type == null) ? 0 : type.hashCode());
        return result;
    }
 
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        DisciplineNode other = (DisciplineNode) obj;
        if (name == null) {
            if (other.name != null)
                return false;
        } else if (!name.equals(other.name))
            return false;
        if (type == null) {
            if (other.type != null)
                return false;
        } else if (!type.equals(other.type))
            return false;
        return true;
    }
 
    @Override
    public String toString() {
        return name;
    }
 
    public int compareTo(DisciplineNode DisciplineNode) {
        return this.getName().compareTo(DisciplineNode.getName());
    }
}  